<template>
  <el-dialog :model-value="visible" title="创建" width="420px" style="height: 385px; color: #fff;">
    <div style="display: flex; justify-content: space-between; margin-bottom: 20px;height: 150px;margin-top: 30px;">
      <div :class="['select-box', selectedType === 'book' ? 'selected' : '']" @click="chooseFile('book')">
        <img src="@/assets/images/icon-book.png" class="create-icon" alt="">
        <p>多页书刊比对</p>
      </div>
      <div :class="['select-box', selectedType === 'pdf' ? 'selected' : '']" @click="chooseFile('pdf')" >
        <img src="@/assets/images/icon-pdf.png" class="create-icon" alt="">
        <p>多页说明书比对</p>
      </div>
    </div>
    <div style="text-align: center;margin-top: 40px;">
      <el-button type="primary" @click="handleConfirm" :icon="Check">确认</el-button>
    </div>
  </el-dialog>
</template>

<script setup>
import { ref } from 'vue'
import { useRouter } from 'vue-router'

const router = useRouter()
const selectedType = ref('')

const props = defineProps({
  visible: {
    type: Boolean,
    required: true
  }
})
const emit = defineEmits(['confirmType'])

function chooseFile(type) {
  selectedType.value = type
}


function handleConfirm() {
  emit('confirmType', selectedType.value);
  selectedType.value = '';
}
</script>

<style scoped>
.select-box{
  flex: 1;
  margin-left: 12px;
  padding: 24px;
  border: 1px solid #409BFF;
  border-radius: 2px;
  text-align: center;
  cursor: pointer;
  border: 1px dashed #409BFF;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.select-box.selected {
  border: 2px solid #409BFF;
  font-size: 16px;
  /* background: #f0f7ff; */
}

</style>